<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>advice page</title>
</head>
<body>

	<button id="dianji">点击</button>
	
	<br><br>
	
	<p id="test"></p>
	<div id="box"></div>
	
<script type="text/javascript" src="${staticContextPath}/resources/jquery/jquery-1.9.0.js"></script>
<script type="text/javascript" src="${staticContextPath}/resources/layer/layer.js"></script>

<script>
	
	$(document).ready(function() {
		
		$("#dianji").click(function() {
			console.log("请求成功!");
			$.ajax({
				async:false,// 同步还是异步
				type:"post",// 请求方式
				url:"${staticContextPath}/test/advice",// 请求地址
				success:function(result,textStatus){// 服务器处理成功时返回
					$("#test").html(result);
				},
				error:function(){// 服务器处理失败时返回
					$("#box").html("<p style=\"color: red\"><b>数据加载失败!!!</b></p>");
				}
			});
		})
		
	})
</script>

</body>
</html>